package com.stars.easyms.logging.properties;

import com.stars.easyms.base.constant.EasyMsCommonConstants;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>className: EasyMsLoggingProperties</p>
 * <p>description: EasyMsLogging属性类</p>
 *
 * @author guoguifang
 * @version 1.7.0
 * @date 2020/11/17 2:49 下午
 */
@Data
@ConfigurationProperties(prefix = EasyMsLoggingProperties.PREFIX)
public class EasyMsLoggingProperties {

    public static final String PREFIX = EasyMsCommonConstants.EASY_MS_PROPERTIES_PREFIX + "logging";

    private final LogColor logColor = new LogColor();

    private final PlumeLog plumeLog = new PlumeLog();

    @Data
    public static class LogColor {

        private boolean enabled = true;

        private Map<String, String> level = new HashMap<>(8);

    }

    @Data
    public static class PlumeLog {

        private boolean enabled = true;

        private String appName;

        private String runModel = "1";

        private String expand;

        private int maxCount = 500;

        private int logQueueSize = 10000;

        private int threadPoolSize = 5;

        private boolean compressor;

        private Redis redis = new Redis();

        private Kafka kafka = new Kafka();

        @Data
        public static class Redis {

            private String host;

            private String port = "6379";

            private String auth;

            private int db = 0;

            private String model;

            private String masterName;

        }

        @Data
        public static class Kafka {

            private String hosts;

        }

    }
}
